package com.hjq.mallmember.web;

import com.alibaba.fastjson.JSON;
import com.hjq.common.utils.R;
import com.hjq.mallmember.feign.OrderFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * @auther HJQ
 */
@Controller
public class MemberWebController {
    @Autowired
    OrderFeign orderFeign;
    @RequestMapping("/pay/return")
    public String payReturn(@RequestParam(value = "pageNum",defaultValue = "1",required = false) Integer pageNum,
                            Model model){
        HashMap<String, Object> param = new HashMap<>();
        param.put("page",pageNum.toString());

        R r = orderFeign.listWithItem(param);
        System.out.println(JSON.toJSONString(r));
        model.addAttribute("orders",r);
        return "memberOrder";
    }
}
